﻿using System.Diagnostics;

namespace LFSRecord2.Model.UserActions
{
    public class UserActionPropertyBindingIgnoreParentingChanged : UserActionBase
    {
        // Action description, so we can replay this action (and reverse it)
        public int LayerIndex { get; set; }
        public int PropertyIndex { get; set; }
        public bool Ignore { get; set; }

        public UserActionPropertyBindingIgnoreParentingChanged()
        {
            Action = UserActionTypes.PropertyBindingIgnoreParentingChanged;
        }

        public override void DoUndo()
        {
            Debug.WriteLine("Undoing a PropertyBindingIgnoreParentingChanged action");
            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].BoundPropertyIgnoreParent = !Ignore;
            LfsRecordController.project.Layers[LayerIndex].UpdatedCurrentValues = CompLayerPropertyUpdateTypes.All;
        }

        public override void DoRedo()
        {
            Debug.WriteLine("Redoing a PropertyBindingIgnoreParentingChanged action");
            LfsRecordController.project.Layers[LayerIndex].Properties[PropertyIndex].BoundPropertyIgnoreParent = Ignore;
            LfsRecordController.project.Layers[LayerIndex].UpdatedCurrentValues = CompLayerPropertyUpdateTypes.All;
        }
    }
}
